Skip to content

Fix groovy gradle classpath conflict#14757

Merged
jdaugherty merged 7 commits into7.0.xfrom
grails-gradle-plugin-groovy
May 20, 2025
Merged

Fix groovy gradle classpath conflict#14757
jdaugherty merged 7 commits into7.0.xfrom
grails-gradle-plugin-groovy

Conversation

@jamesfredley
Copy link
Copy Markdown
Contributor

@jamesfredley jamesfredley commented May 19, 2025

  1. Switch groovy to scope 'compileOnly' for the grails gradle plugin
  2. Split gradle tasks into a new project grails-gradle-tasks due to process islation in gradle & not having a shared classpath

Without these changes, including grails projects with commands in the gradle classpath will cause a conflict:
conflict on capability 'org.codehaus.groovy:groovy:3.0.24' also provided by org.apache.groovy:groovy:4.0.26 #14756

The following conflict is now occurring on grails-shell and grails-forge generated 7.0.0-SNAPSHOT applications

A problem occurred configuring root project 'Test22'.
> Could not resolve all artifacts for configuration 'classpath'.
   > Could not resolve org.apache.groovy:groovy:4.0.26.
     Required by:
         root project : > org.apache.grails:grails-bom:7.0.0-SNAPSHOT:20250517.183431-81 > org.apache.groovy:groovy-bom:4.0.26
         root project : > org.apache.grails:grails-bom:7.0.0-SNAPSHOT:20250517.183431-81 > org.apache.grails:grails-spring:7.0.0-SNAPSHOT:20250517.183431-81 > org.apache.groovy:groovy-xml:4.0.26
      > Module 'org.apache.groovy:groovy' has been rejected:
           Cannot select module with conflict on capability 'org.codehaus.groovy:groovy:4.0.26' also provided by [org.codehaus.groovy:groovy:3.0.24(runtime)]
   > Could not resolve org.codehaus.groovy:groovy.
     Required by:
         root project : > org.apache.grails:grails-gradle-plugins:7.0.0-SNAPSHOT:20250517.180618-108
      > Module 'org.codehaus.groovy:groovy' has been rejected:
           Cannot select module with conflict on capability 'org.codehaus.groovy:groovy:3.0.24' also provided by [org.apache.groovy:groovy:4.0.26(groovyRuntimeElements)]
> There are 2 more failures with identical causes.

…scope back to compileOnly

to avoid conflict with Groovy 4 in end application

conflict on capability 'org.codehaus.groovy:groovy:3.0.24' also provided by org.apache.groovy:groovy:4.0.26
#14756
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a dependency conflict by switching the dependency scope for Groovy from implementation to compileOnly, ensuring compatibility with Groovy 3 while preventing inadvertent inclusion of Groovy 4.

  • Change dependency declaration for 'org.codehaus.groovy:groovy' from implementation to compileOnly
  • Alleviate conflicting version issues between Groovy 3 and Groovy 4 in generated applications

@apache apache deleted a comment from Copilot AI May 19, 2025
@jamesfredley jamesfredley requested a review from jdaugherty May 19, 2025 22:21
@jamesfredley jamesfredley changed the title Change grails-gradle-plugins, groovy Gradle dependency configuration … Add grails-gradle-tasks since newer versions of Gradle isolate classpaths of Gradle tasks to avoid conflict with Groovy 4 in end application May 19, 2025
@jdaugherty jdaugherty changed the title Add grails-gradle-tasks since newer versions of Gradle isolate classpaths of Gradle tasks to avoid conflict with Groovy 4 in end application Fix groovy gradle classpath conflict May 19, 2025
@jdaugherty jdaugherty merged commit f78097d into 7.0.x May 20, 2025
30 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache Grails May 20, 2025
@jamesfredley jamesfredley deleted the grails-gradle-plugin-groovy branch May 20, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

conflict on capability 'org.codehaus.groovy:groovy:3.0.24' also provided by org.apache.groovy:groovy:4.0.26

3 participants